\section{Source/DoublyLinkedList.h}


\begin{footnotesize}\begin{alltt}
00001 \textcolor{preprocessor}{#ifndef DOUBLY\_LINKED\_LIST\_HEADER}
00002 \textcolor{preprocessor}{}\textcolor{preprocessor}{#define DOUBLY\_LINKED\_LIST\_HEADER}
00003 \textcolor{preprocessor}{}
00004 \textcolor{preprocessor}{#ifdef \_\_cplusplus}
00005 \textcolor{preprocessor}{}\textcolor{keyword}{extern} \textcolor{stringliteral}{"C"}
00006 \{
00007 \textcolor{preprocessor}{#endif}
00008 \textcolor{preprocessor}{}
00009 \textcolor{preprocessor}{#include <stdlib.h>}
00010 
00011 \textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_DLL\_Element
00012 \{
00013     \textcolor{keywordtype}{void} *Data;
00014     \textcolor{keyword}{struct }\_DLL\_Element *Previous;
00015     \textcolor{keyword}{struct }\_DLL\_Element *Next;
00016 \}DLL_Element;
00017 \textcolor{comment}{/* struct \_DLL\_Element}
00018 \textcolor{comment}{\{}
00019 \textcolor{comment}{    void *Data;}
00020 \textcolor{comment}{    \_DLL\_Element *Previous;}
00021 \textcolor{comment}{    \_DLL\_Element *Next;}
00022 \textcolor{comment}{\};}
00023 \textcolor{comment}{}
00024 \textcolor{comment}{typedef \_DLL\_Element DLL\_Element;*/}
00025 
00026 \textcolor{comment}{/* This function creates the end of the list with element two,}
00027 \textcolor{comment}{    and puts it after element one}
00028 \textcolor{comment}{    Return:}
00029 \textcolor{comment}{        This function will return a pointer to One}
00030 \textcolor{comment}{*/}
00031 DLL_Element *DLL\_AppendElement(DLL_Element *One, DLL_Element *Two);
00032 
00033 \textcolor{comment}{/* This function will inset an element after one, and shift everything}
00034 \textcolor{comment}{    along one}
00035 \textcolor{comment}{    Return:}
00036 \textcolor{comment}{        This function will return a pointer to One}
00037 \textcolor{comment}{*/}
00038 DLL_Element *DLL\_InsertElement(DLL_Element *One, DLL_Element *Two);
00039 
00040 \textcolor{comment}{/* This function will return the DLL\_Element N elements after From}
00041 \textcolor{comment}{*/}
00042 DLL_Element *DLL\_GetNthElementFrom(DLL_Element *From, \textcolor{keywordtype}{int} N);
00043 \textcolor{comment}{/* This function goes backward from Before N times and returns the }
00044 \textcolor{comment}{    element that is there}
00045 \textcolor{comment}{*/}
00046 DLL_Element *DLL\_GetNthElementBefore(DLL_Element *Before, \textcolor{keywordtype}{int} N);
00047 
00048 \textcolor{comment}{/* These two functions returns the size until the end from From,}
00049 \textcolor{comment}{    and until the start from Before respectively}
00050 \textcolor{comment}{*/}
00051 \textcolor{keywordtype}{int} DLL\_GetSizeFrom(DLL_Element *From);
00052 \textcolor{keywordtype}{int} DLL\_GetSizeBefore(DLL_Element *Before);
00053 
00054 \textcolor{comment}{/* This function will remove all elements between One and Two}
00055 \textcolor{comment}{*/}
00056 DLL_Element *DLL\_RemoveElementsBetween(DLL_Element *One, DLL_Element *Two);
00057 \textcolor{comment}{/* This function will append ListTwo onto ListOne}
00058 \textcolor{comment}{    Return:}
00059 \textcolor{comment}{        This function will return a pointer to One;}
00060 \textcolor{comment}{*/}
00061 DLL_Element *DLL\_AppendList(DLL_Element *ListOne, DLL_Element *ListTwo);
00062 \textcolor{comment}{/* This function will insert List at At}
00063 \textcolor{comment}{    Return:}
00064 \textcolor{comment}{        This function will return a pointer to At}
00065 \textcolor{comment}{*/}
00066 DLL_Element *DLL\_InsertList(DLL_Element *At, DLL_Element *List);
00067 
00068 \textcolor{comment}{/* These functions will get the first and last elements respectivally,}
00069 \textcolor{comment}{    assuming they have been delimited by NULLs}
00070 \textcolor{comment}{*/}
00071 DLL_Element *DLL\_GetFirstElement(DLL_Element *Element);
00072 DLL_Element *DLL\_GetLastElement(DLL_Element *Element);
00073 
00074 \textcolor{comment}{/* This function will swap the elements A and B and return a pointer to A}
00075 \textcolor{comment}{*/}
00076 DLL_Element *DLL\_Swap(DLL_Element *A, DLL_Element *B);
00077 
00078 \textcolor{preprocessor}{#ifdef \_\_cplusplus}
00079 \textcolor{preprocessor}{}\}
00080 \textcolor{preprocessor}{#endif}
00081 \textcolor{preprocessor}{}
00082 \textcolor{preprocessor}{#endif}
\end{alltt}\end{footnotesize}
